package com.snpic.appaw.module.third.config;

import com.snpic.appaw.module.third.dal.pojo.SmsReqEntity;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author JiJun
 * @date 2025/8/28 16:12
 * @修改时间 2025/8/28 16:12
 * @description 读取application.yaml中third-party.sms下的配置
 */
@Data
@Component
@ConfigurationProperties(prefix = "third-party.sms")
public class SmsConfig {
	private String url;
	private String username;
	private String password;

	/**
	 * 自动传入账号密码,以构建一个新的SmsReqEntity对象
	 * @param phone
	 * @param content
	 * @return
	 */
	public SmsReqEntity createSmsRequest(String phone, String content) {
		return new SmsReqEntity()
			.setSendCustomer(username)
			.setSendCustomepwd(password)
			.setToMobile(phone)
			.setXMSCONTENT(content);
	}
}
